package org.lee.config;

import javax.transaction.TransactionManager;
import javax.transaction.UserTransaction;

import org.hibernate.engine.transaction.jta.platform.internal.AbstractJtaPlatform;

//@Component
public class AtomikosJtaPlatform extends AbstractJtaPlatform {

	private static final long serialVersionUID = 1L;

	protected static TransactionManager transactionManager;
//	
	protected static UserTransaction transaction;

//	public AtomikosJtaPlatform(UserTransaction transaction, TransactionManager transactionManager){
//		this.transaction = transaction;
//		this.transactionManager = transactionManager;
//	}
	
//	public abstract TransactionManager lookupTransactionManager();
//	public abstract UserTransaction lookupUserTransaction();
	
	@Override
	protected TransactionManager locateTransactionManager() {
		return transactionManager;
	}

	@Override
	protected UserTransaction locateUserTransaction() {
		return transaction;
	}

	public void setTransactionManager(TransactionManager transactionManager) {
		AtomikosJtaPlatform.transactionManager = transactionManager;
	}

	public void setTransaction(UserTransaction transaction) {
		AtomikosJtaPlatform.transaction = transaction;
	}

}
